import 'package:flutter/material.dart';

class HomeLike extends StatelessWidget {
 HomeLike({ super.key,required this.goodList }) ;

  List goodList =[];

  @override
  Widget build(BuildContext context){
    return ListView.separated(
        shrinkWrap: true,
        physics: const NeverScrollableScrollPhysics(),
        itemBuilder: (context,index){
          Map item = goodList[index];
          return Container(
            padding: const EdgeInsets.all(10),
            color: Colors.white,
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Image.network(
                  item['goods_image'],
                  width:80,
                  height: 80,
                ),
                Expanded(
                  child: Padding(
                    padding: EdgeInsets.only(left: 5),
                    child:  Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                         "${item['goods_name']}"   ,
                         maxLines: 2,
                         overflow: TextOverflow.ellipsis,
                      ),
                      Text(
                        "已售${item['goods_sales']}件",style: TextStyle(color:Color.fromRGBO(255, 107, 98, 98)),
                      ),
                      Row(
                        children: [
                          Text("¥${item['goods_price_min']}", style: const TextStyle(color: Colors.red),),
                            Padding(
                            padding: const EdgeInsets.only(left: 5),
                            child: Text(
                          "¥${item['line_price_min']}",
                          style: const TextStyle(
                              color: Color.fromARGB(255, 107, 98, 98), decoration: TextDecoration.lineThrough),
                        ),
                            )
                        ],
                      )
                    ],
                  ),
                  ),  
                ),
              ],
            ),
          );
        },
        separatorBuilder: (context,index){
           return Container(
            height: 6,
            color: Colors.grey[200],
           );
        },
        itemCount: goodList.length,
    );
  }
}
